package com.milktea.dao.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.milktea.dao.MilkteaShopDao;
import com.milktea.entity.Milktea;

@Repository
public class MilkteaShopDaoImpl implements MilkteaShopDao {

	@Autowired
	private JdbcTemplate jdbcTemplate;
	
	@Override
	public void register(String username, String password) {
		String sql = "select trans_num from t_trans where shop_id = ?";
		int transNum = jdbcTemplate.queryForInt(sql, new Object[]{username});
		System.out.println(transNum);

	}

	@Override
	public Milktea findByUsername(String username) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void makeTransaction(String shopId, String userId, int transNum) {
		String sql =  "insert into t_trans (shop_id, user_id, trans_num) values (?, ?, ?)";
		jdbcTemplate.update(sql, new Object[]{shopId, userId, transNum});
	}

}
